package com.learn.demo.lambda.core4api;

import java.util.Arrays;
import java.util.List;
import java.util.function.Predicate;

/**
 * 断言型接口
 *
 * @author banjiawei
 * @date 2021/06/19
 */
public class PredicateDemo {
    public static void main(String[] args) {
        Predicate<String> predicate = (str) -> str.length() > 3;
        List<String> stringList = Arrays.asList("hello", "world", "hi", "java", "how", "do", "you", "do", "?");
        for (String s : stringList) {
            if(predicate.test(s)){
                System.out.println(s);
            }
        }
    }
}
